package panel.viewSpots
{
	import assists.Lang;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.Sprite;
	import flash.display.Stage;
	
	import struct.Scenic;
	
	public class ViewSpotPicGroup extends Sprite
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _spotList:Array;
		private var _openDetail:Function;
		private var _uri:URI;
		
		public function ViewSpotPicGroup()
		{
			super();
		}
		
		 public function init(stage:Stage,loader:ResourceLoader,lang:Lang,uri:URI):void
		{
			 _spotList = [];
			_stage = stage;
			_loader = loader;
			_uri = uri;
		}
		
		public function showSpotList(dataList:Array):void
		{
			
			var len:int = dataList.length;
			for(var i:int = 0;i<len;i++)
			{
				var spotPic:ViewSpotPic = new ViewSpotPic(_stage,_loader);
				spotPic.onOpenDetail = _openDetail;
				spotPic.posId = i;
				spotPic.init(dataList[i]);
				_spotList.push(spotPic);
				this.addChild(spotPic);
			}
		}
		
		public function set onOpenDetail(value:Function):void
		{
			_openDetail = value;
		}
		
		public function clear():void
		{
			var len:int = _spotList.length;
			for(var i:int = 0;i<len;i++)
			{
				var spotPic:ViewSpotPic = _spotList[i]
				spotPic.clear();
				this.removeChild(spotPic);
			}
			_spotList = [];
		}
		
	}
}